﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DbfViewer.Models.DataTypes;

namespace DbfViewer.Models
{
	public static class DbfHelper
	{
		public static IDataType GetDbfType(Type type)
		{
			switch (type.ToString())
			{
				case "System.Boolean":
					return new Logical();
				case "System.DateTime":
					return new Date();
				case "System.SByte":
				case "System.Byte":
				case "System.Int16":
				case "System.UInt16":
				case "System.Int32":
				case "System.UInt32":
				case "System.Int64":
				case "System.UInt64":
					return new Numeric();
				case "System.Single":
				case "System.Double":
				case "System.Decimal":
					return new Float();
				default:
					return new Character();
			}
		}
	}
}
